﻿using System.Collections.Generic;

namespace GaussianBenchmark
{
    internal class MultiGaussianCurve
    {
        private List<ImmutableGaussianCurve> componentFunctions;

        public IEnumerable<ImmutableGaussianCurve> ComponentFunction
        {
            get { return componentFunctions.AsReadOnly(); }
        }

        public MultiGaussianCurve(IEnumerable<ImmutableGaussianCurve> Pdfs)
        {
            componentFunctions = new List<ImmutableGaussianCurve>(Pdfs);
        }

        public double Evaluate(double x)
        {
            double agrigator = 0;
            foreach (ImmutableGaussianCurve func in componentFunctions)
            {
                agrigator += func.Density(x);
            }
            return agrigator;
        }
    }
}
